using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using emp.Model;
using emp.BLL;
using emp.IDAL;

namespace emp.ProcessFlow
{
    public class Campaign_ChannelCotroller
    {
        public bool Insert(emp.Model.Campaign_ChannelInfo cacInfo)
        {
            try
            {
                // Creata a new business logic tier
                emp.BLL.Campaign_Channel cacBll = new emp.BLL.Campaign_Channel();
                // Call the insert method

                string url = "Campaign_Channel.aspx?cac_uid=" + cacBll.Insert(cacInfo); 
                HttpContext.Current.Response.Redirect(url, true);

            }
            catch
            {
                return false;
            }
            return true;
        }
        public void Delete(string cac_uid,string cam_uid)
        {
            emp.BLL.Campaign_Channel chabll = new emp.BLL.Campaign_Channel();
            chabll.Delete(cac_uid);
            string url = "CampaignModify.aspx?cam_uid=" + cam_uid;
            HttpContext.Current.Response.Redirect(url, true);
        }
        public void SelectQusetSave(string qsd_id,string type)
        {
            HttpRequest request = HttpContext.Current.Request;

            string url = "../campaign/Campaign_Channel.aspx?cac_uid=" + request["cac_uid"] + "&" + type + "quest_id=" + qsd_id + "&temp_quest_uid=" + request["temp_quest_uid"];
            HttpContext.Current.Response.Redirect(url, true);
        }

        public void Save(Campaign_ChannelInfo cacInfo)
        {
            emp.BLL.Campaign_Channel cacBll = new emp.BLL.Campaign_Channel();
                 
            cacBll.Update(cacInfo);
            string url = "CampaignModify.aspx?cam_uid=" + cacInfo.iCAC_CAM_UID;
            HttpContext.Current.Response.Redirect(url, true);
        }
        public void UpdateState(int cac_uid, string cac_state,string cam_uid)
        {
            emp.BLL.Campaign_Channel chabll = new emp.BLL.Campaign_Channel();
            chabll.UpdateState(cac_uid, cac_state);
            string url = "CampaignModify.aspx?cam_uid=" + cam_uid;
            HttpContext.Current.Response.Redirect(url, true);

        }


    }
}
